C (76/254)

From:Colin Wenzel
Date:20 Apr 00 at 15:01:06
Subject:Re: How to change stack

As a supliment to my previous email....

Here is the old c.lib version:
...........................

_StackSwap:
MOVE.L A6,-(SP)
MOVEA.L (_SysBase),A6
MOVEM.L 8(SP),D0/D1/A0
JSR _LVOStackSwap(A6)
MOVEA.L (SP)+,A6
RTS
.........................

The amiga.lib stub for StackSwap() is faulty.
This works:

...................

xref _SysBase
public _StackSwap

_StackSwap
move.l 4(sp),a0
move.l (_SysBase),a6
JMP _LVOStackSwap(A6)

..................

It's passing the wrong number & wrong argument......
The autodocs specify only one argument, the pointer to
the stackswap structure, in A0

The actual call StackSwap() copies the return address to
the new stack, so that when it RTS's it is the same return address
that was about to be popped off the old stack.

It ONLY copies 1 long word, so the return address is the only
thing copied....

-------------------------------------
Colin Wenzel. Australia.

EMAIL: mailto:colstv@hotkey.net.au
URL: http://www.hotkey.net.au/~colstv/
ICQ: 17608330
AMIGA: 4000T, 68060/50, 150Mb RAM,
OS 3.5, EGS Spectrum.
---------------------------------------

------------------------------------------------------------------------
Your high school sweetheart-where is he now? With 4.4 million alumni
already registered at Classmates.com, there's a good chance you'll
find her here. Visit your online high school class reunion at:
http://click.egroups.com/1/3139/1/_/451227/_/956239460/
------------------------------------------------------------------------